package com.zg.common.alter.autoconfigure;

import com.zg.common.alter.interceptor.AlertInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/2/12 18:16
 */
@RequiredArgsConstructor
public class AlertWebMvcConfig implements WebMvcConfigurer {

    private final AlertInterceptor interceptor;
    private final AlertProperties properties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
                .addPathPatterns(properties.getIncludePaths())
                .excludePathPatterns(properties.getExcludePaths());
    }
}
